package net.int0r.gscore.gobjects;

import net.int0r.gscore.util.GJSONObject;
import net.int0r.gscore.util.GStringUtil;

public class User {
	private String imageUrl = "";
	private String firstName = "";
	private String lastName = "";
	private String homeTown = "";
	private String personUrl = "";
	private String website = "";
	private boolean isFriend = false;
	private int friendsCount = 0;
	private Spot lastCheckin;
	private String bio;
	private int visitedSpotsCount = 0;
	private int itemsCount = 0;
	private int fbId = 0;
	private int pinsCount = 0;
	private int stampsCount = 0;
	private String requestUrl = "";
	private String twitterName = "";
	private String topSpotsUrl = "";
	private int vaultedCount = 0;
	private String acceptUrl = "";
	private String friendsUrl = "";
	private String userName = "";
	private String activityUrl = "";
	private String stampsUrl = "";
	private String rejectUrl = "";
	private boolean friendsOnly = false;
	private String pinsUrl = "";
	private String itemsUrl = "";
	
	
	public String getItemsUrl() {
		return itemsUrl;
	}
	public void setItemsUrl(String itemsUrl) {
		this.itemsUrl = itemsUrl;
	}
	public String getPinsUrl() {
		return pinsUrl;
	}
	public void setPinsUrl(String pinsUrl) {
		this.pinsUrl = pinsUrl;
	}
	public boolean isFriend() {
		return isFriend;
	}
	public void setFriend(boolean isFriend) {
		this.isFriend = isFriend;
	}
	public int getFriendsCount() {
		return friendsCount;
	}
	public void setFriendsCount(int friendsCount) {
		this.friendsCount = friendsCount;
	}
	public Spot getLastCheckin() {
		return lastCheckin;
	}
	public void setLastCheckin(Spot lastCheckin) {
		this.lastCheckin = lastCheckin;
	}
	public String getBio() {
		return bio;
	}
	public void setBio(String bio) {
		this.bio = bio;
	}
	public int getVisitedSpotsCount() {
		return visitedSpotsCount;
	}
	public void setVisitedSpotsCount(int visitedSpotsCount) {
		this.visitedSpotsCount = visitedSpotsCount;
	}
	public int getItemsCount() {
		return itemsCount;
	}
	public void setItemsCount(int itemsCount) {
		this.itemsCount = itemsCount;
	}
	public int getFbId() {
		return fbId;
	}
	public void setFbId(int fbId) {
		this.fbId = fbId;
	}
	public int getPinsCount() {
		return pinsCount;
	}
	public void setPinsCount(int pinsCount) {
		this.pinsCount = pinsCount;
	}
	public int getStampsCount() {
		return stampsCount;
	}
	public void setStampsCount(int stampsCount) {
		this.stampsCount = stampsCount;
	}
	public String getRequestUrl() {
		return requestUrl;
	}
	public void setRequestUrl(String requestUrl) {
		this.requestUrl = requestUrl;
	}
	public String getTwitterName() {
		return twitterName;
	}
	public void setTwitterName(String twitterName) {
		this.twitterName = twitterName;
	}
	public String getTopSpotsUrl() {
		return topSpotsUrl;
	}
	public void setTopSpotsUrl(String topSpotsUrl) {
		this.topSpotsUrl = topSpotsUrl;
	}
	public int getVaultedCount() {
		return vaultedCount;
	}
	public void setVaultedCount(int vaultedCount) {
		this.vaultedCount = vaultedCount;
	}
	public String getAcceptUrl() {
		return acceptUrl;
	}
	public void setAcceptUrl(String acceptUrl) {
		this.acceptUrl = acceptUrl;
	}
	public String getFriendsUrl() {
		return friendsUrl;
	}
	public void setFriendsUrl(String friendsUrl) {
		this.friendsUrl = friendsUrl;
	}
	public String getUserName() {
		return userName;
	}
	public void setUserName(String userName) {
		this.userName = userName;
	}
	public String getActivityUrl() {
		return activityUrl;
	}
	public void setActivityUrl(String activityUrl) {
		this.activityUrl = activityUrl;
	}
	public String getStampsUrl() {
		return stampsUrl;
	}
	public void setStampsUrl(String stampsUrl) {
		this.stampsUrl = stampsUrl;
	}
	public String getRejectUrl() {
		return rejectUrl;
	}
	public void setRejectUrl(String rejectUrl) {
		this.rejectUrl = rejectUrl;
	}
	public boolean isFriendsOnly() {
		return friendsOnly;
	}
	public void setFriendsOnly(boolean friendsOnly) {
		this.friendsOnly = friendsOnly;
	}
	public String getImageUrl() {
		return imageUrl;
	}
	public void setImageUrl(String imageUrl) {
		this.imageUrl = imageUrl;
	}
	public String getFirstName() {
		return firstName;
	}
	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}
	public String getLastName() {
		return lastName;
	}
	public void setLastName(String lastName) {
		this.lastName = lastName;
	}
	public String getHomeTown() {
		return homeTown;
	}
	public void setHomeTown(String homeTown) {
		this.homeTown = homeTown;
	}
	public String getPersonUrl() {
		return personUrl;
	}
	public void setPersonUrl(String personUrl) {
		this.personUrl = personUrl;
	}
	public int getUserId() {
		return GStringUtil.getId(getPersonUrl());
	}
	public String getWebsite() {
		return website;
	}
	public void setWebsite(String website) {
		this.website = website;
	}
	
	public User(GJSONObject jsobj) {
		try {
			setImageUrl(jsobj.getString("image_url"));
			setFirstName(jsobj.getString("first_name"));
			setLastName(jsobj.getString("last_name"));
			setPersonUrl(jsobj.getString("url"));
			setHomeTown(jsobj.getString("hometown"));
			setWebsite(jsobj.getString("website"));
			setPinsUrl(jsobj.getString("pins_url"));
			setFriend(jsobj.getBoolean("is_friend"));
			setFriendsCount(jsobj.getInt("friends_count"));
			if(!jsobj.isNull("last_checkin"))
				setLastCheckin(new Spot(new GJSONObject(jsobj.getJSONObject("last_checkin").toString())));
			setBio(jsobj.getString("bio"));
			setItemsUrl(jsobj.getString("items_url"));
			setVisitedSpotsCount(jsobj.getInt("visited_spots_count"));
			setItemsCount(jsobj.getInt("items_count"));
			setFbId(jsobj.getInt("fb_id"));
			setPinsCount(jsobj.getInt("pins_count"));
			setStampsCount(jsobj.getInt("stamps_count"));
			setRejectUrl(jsobj.getString("request_url"));
			setTwitterName(jsobj.getString("twitter_username"));
			setTopSpotsUrl(jsobj.getString("top_spots_url"));
			setVaultedCount(jsobj.getInt("vaulted_kinds_count"));
			setAcceptUrl(jsobj.getString("accept_url"));
			setFriendsUrl(jsobj.getString("friends_url"));
			setUserName(jsobj.getString("username"));
			setActivityUrl(jsobj.getString("activity_url"));
			setStampsUrl(jsobj.getString("stamps_url"));
			setRejectUrl(jsobj.getString("reject_url"));
			setFriendsOnly(jsobj.getBoolean("friends_only"));
		}
		catch(Exception ex) {
			ex.printStackTrace();
		}
		
	}
	
	public String toString() {
		return ("\ngetFirstName(): "+getFirstName()
				+"\ngetHomeTown(): "+getHomeTown()
				+"\ngetImageUrl(): "+getImageUrl()
				+"\ngetLastName(): "+getLastName()
				+"\ngetPersonUrl(): "+getPersonUrl()
				+"\ngetUserId(): "+getUserId());
	}
	
	
}
